package com.ruoyi.web.controller.dispatch;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.DispatchReportQueryExportRecords;
import com.ruoyi.system.service.IDispatchReportQueryExportRecordsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 报查询与导出记录Controller
 * 
 * @author ruoyi
 * @date 2025-03-02
 */
@RestController
@RequestMapping("/system/dispatchReportQueryExportRecords")
public class DispatchReportQueryExportRecordsController extends BaseController
{
    @Autowired
    private IDispatchReportQueryExportRecordsService dispatchReportQueryExportRecordsService;

    /**
     * 查询报查询与导出记录列表
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchReportQueryExportRecords:list')")
    @GetMapping("/list")
    public TableDataInfo list(DispatchReportQueryExportRecords dispatchReportQueryExportRecords)
    {
        startPage();
        List<DispatchReportQueryExportRecords> list = dispatchReportQueryExportRecordsService.selectDispatchReportQueryExportRecordsList(dispatchReportQueryExportRecords);
        return getDataTable(list);
    }

    /**
     * 导出报查询与导出记录列表
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchReportQueryExportRecords:export')")
    @Log(title = "报查询与导出记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DispatchReportQueryExportRecords dispatchReportQueryExportRecords)
    {
        List<DispatchReportQueryExportRecords> list = dispatchReportQueryExportRecordsService.selectDispatchReportQueryExportRecordsList(dispatchReportQueryExportRecords);
        ExcelUtil<DispatchReportQueryExportRecords> util = new ExcelUtil<DispatchReportQueryExportRecords>(DispatchReportQueryExportRecords.class);
        util.exportExcel(response, list, "报查询与导出记录数据");
    }

    /**
     * 获取报查询与导出记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchReportQueryExportRecords:query')")
    @GetMapping(value = "/{reportQueryExportRecordsId}")
    public AjaxResult getInfo(@PathVariable("reportQueryExportRecordsId") Long reportQueryExportRecordsId)
    {
        return success(dispatchReportQueryExportRecordsService.selectDispatchReportQueryExportRecordsByReportQueryExportRecordsId(reportQueryExportRecordsId));
    }

    /**
     * 新增报查询与导出记录
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchReportQueryExportRecords:add')")
    @Log(title = "报查询与导出记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DispatchReportQueryExportRecords dispatchReportQueryExportRecords)
    {
        return toAjax(dispatchReportQueryExportRecordsService.insertDispatchReportQueryExportRecords(dispatchReportQueryExportRecords));
    }

    /**
     * 修改报查询与导出记录
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchReportQueryExportRecords:edit')")
    @Log(title = "报查询与导出记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DispatchReportQueryExportRecords dispatchReportQueryExportRecords)
    {
        return toAjax(dispatchReportQueryExportRecordsService.updateDispatchReportQueryExportRecords(dispatchReportQueryExportRecords));
    }

    /**
     * 删除报查询与导出记录
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchReportQueryExportRecords:remove')")
    @Log(title = "报查询与导出记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{reportQueryExportRecordsIds}")
    public AjaxResult remove(@PathVariable Long[] reportQueryExportRecordsIds)
    {
        return toAjax(dispatchReportQueryExportRecordsService.deleteDispatchReportQueryExportRecordsByReportQueryExportRecordsIds(reportQueryExportRecordsIds));
    }
}
